package com.yl.users.services.impl

import com.baomidou.mybatisplus.core.toolkit.Wrappers
import com.baomidou.mybatisplus.extension.plugins.pagination.Page
import com.yl.common.ErrorCode
import com.yl.common.control.ResponseBody
import com.yl.common.control.returnError
import com.yl.common.control.returnSuccess
import com.yl.users.entity.CompanyTableField
import com.yl.users.entity.SysTableFieldPerm
import com.yl.users.mapper.CompanyRoleTableFieldMapper
import com.yl.users.services.ISysTableFieldPermService
import com.yl.users.mapper.CompanyTableFieldMapper
import com.yl.users.mapper.SysTableFieldPermMapper
import org.springframework.stereotype.Service

@Service
open class SysTableFieldPermServiceImpl(
    private val sysTableFieldPermMapper: SysTableFieldPermMapper,

    private val companyTableFieldMapper: CompanyTableFieldMapper,

    private val companyRoleTableFieldMapper: CompanyRoleTableFieldMapper
) : ISysTableFieldPermService {

    override fun updateField(sysTableFieldPerm: SysTableFieldPerm) {
        sysTableFieldPermMapper.updateById(sysTableFieldPerm)
    }

    override fun haveSub(id: Long): Boolean {
        return sysTableFieldPermMapper.selectCount(Wrappers.query<SysTableFieldPerm?>().eq("super_id", id)) != 0
    }
}